#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#define maxn 10005
int n;
int x1, y1, x2, y2;
bool a[maxn][maxn] ;
int main()
{
	scanf("%d", &n);
	for (int k = 0; k < n; k++)
	{
		scanf("%d%d%d%d", &x1, &y1, &x2, &y2);

		for (int i = x1; i < x2; i++)
		{
			for (int j = y1; j < y2; j++)
			{
				if (a[i][j] == 0)
				{
					a[i][j] = 1;
				}
			}
		}
	}
	int res = 0;
	for (int i = 0; i < maxn; i++)
	{
		for (int j = 0; j < maxn; j++)
		{
			if (a[i][j] == 1)
			{
				res++;
			}
		}
	}
	printf("%d", res);
	return 0;
}